package com.yangguang.huahui.ui.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yangguang.huahui.Config;
import com.yangguang.huahui.R;
import com.yangguang.huahui.entity.DataInfo;
import com.yangguang.huahui.ui.activitys.AuthManagerActivity;
import com.yangguang.huahui.ui.activitys.BlacklistActivity;
import com.yangguang.huahui.ui.activitys.FriendsActivity;
import com.yangguang.huahui.ui.activitys.MySecondActivity;
import com.yangguang.huahui.ui.activitys.PersonInfoActivity;
import com.yangguang.huahui.ui.activitys.PublishListActivity;
import com.yangguang.huahui.ui.activitys.SettingActivity;
import com.yangguang.huahui.utils.ImageLoader;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/3/2.
 */

public class MyFragment extends BaseFragment{
    public static MyFragment newInstance(String type){
        MyFragment fragment = new MyFragment();
        Bundle arguments = new Bundle();
        arguments.putString("type", type);
        fragment.setArguments(arguments);
        return fragment;
    }

    @BindView(R.id.iv_head)
    ImageView iv_head;
    @BindView(R.id.tv_name)
    TextView tv_name;
    @OnClick({R.id.mLL_info, R.id.mLL_auth, R.id.mLL_my_publish, R.id.mLL_blacklist, R.id.mLL_friends, R.id.mLL_setting,
    R.id.mLL_my_questions_answers, R.id.mLL_myqrcode, R.id.mLL_my_like})
    void onClick(View v){
        switch (v.getId()){
            case R.id.mLL_info:
                startActivity(new Intent(mActivity, PersonInfoActivity.class));
                break;
            case R.id.mLL_auth:
                startActivity(new Intent(mActivity, AuthManagerActivity.class));
                break;
            case R.id.mLL_blacklist:
                startActivity(new Intent(mActivity, BlacklistActivity.class));
                break;
            case R.id.mLL_friends:
                startActivity(new Intent(mActivity, FriendsActivity.class));
                break;
            case R.id.mLL_my_publish:
                startActivity(new Intent(mActivity, PublishListActivity.class));
                break;
            case R.id.mLL_setting:
                startActivity(new Intent(mActivity, SettingActivity.class));
                break;
            case R.id.mLL_my_questions_answers:
                startActivity(new Intent(mActivity, MySecondActivity.class).putExtra("type", 1)
                        .putExtra("title", getString(R.string.my_question_answers)));
                break;
            case R.id.mLL_myqrcode:
                startActivity(new Intent(mActivity, MySecondActivity.class).putExtra("type", 2)
                        .putExtra("title", getString(R.string.my_qrcode)));
                break;
            case R.id.mLL_my_like:
                startActivity(new Intent(mActivity, MySecondActivity.class).putExtra("type", 3)
                        .putExtra("title", getString(R.string.like)));
                break;
        }
    }
    @Override
    protected int initLayoutId() {
        return R.layout.index_my;
    }

    @Override
    protected void initView() {
        ImageLoader.loadCircle(mActivity, DataInfo.AVATARS, iv_head);
        tv_name.setText(DataInfo.NICKNAME);
    }

    @Override
    protected void initData() {
    }

}
